import cgi
import wsgiref.handlers
import os

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext import db
  
class SearchView(webapp.RequestHandler):
    def get(self, prefix, search_term):
         self.response.out.write('<html><body>Search Page<br/>Prefix: ')
         self.response.out.write(prefix)
         if search_term:
               self.response.out.write('<br/>Search term: ')
               self.response.out.write(search_term)
         self.response.out.write('</body></html>')
    
def main():
    application = webapp.WSGIApplication(
                                       [(r'(.*)search()', SearchView),
                                        (r'(.*)search/(.*)', SearchView)],
                                       debug=True)
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
    main()